package work3_16;

import java.util.Scanner;

public class peoblem2 {
    /**
     * 统计字符串中数字个数
     * 如：“abc21b416u” ===> 输出5
     */
    public static void count(String num) {
        int a=0;int b=0;
       for (int i = 0; i < num.length(); i++) {
           char num1=num.charAt(i);
                if (num1>='0'&&num1<='9') {
                    a++;
                }else {
                    b++;
                }
                }
        System.out.println("数字的个数是："+a+",字母的个数是："+b);
            }




    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("输入字符串：");
        String num= sc.next();
        count(num);
    }
}
